{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Lab-03-1 Minimizing Cost show graph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "import matplotlib.pyplot as plt\n",
    "tf.set_random_seed(777)  # for reproducibility"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## X and Y data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X = [1, 2, 3]\n",
    "Y = [1, 2, 3]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Variable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "W = tf.placeholder(tf.float32)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Our Model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Our hypothesis for linear model X * W\n",
    "hypothesis = X * W\n",
    "\n",
    "# cost/loss function\n",
    "cost = tf.reduce_mean(tf.square(hypothesis - Y))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Prepare session"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Launch the graph in a session.\n",
    "sess = tf.Session()\n",
    "# Initializes global variables in the graph.\n",
    "sess.run(tf.global_variables_initializer())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get Cost"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Variables for plotting cost function\n",
    "W_history = []\n",
    "cost_history = []\n",
    "\n",
    "for i in range(-30, 50):\n",
    "    curr_W = i * 0.1\n",
    "    curr_cost = sess.run(cost, feed_dict={W: curr_W})\n",
    "    W_history.append(curr_W)\n",
    "    cost_history.append(curr_cost)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Show graph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd41eX9//HnOzuQRSAJmYQ9ZASIAURBGVYFWWpFEXG0\naGutVavVnx221jqr1a8TR00d4MK6EEQEAUEgbDBAyCAJIzuQAZn3748cLLWBnJDkfM54P66LK+ec\nnHBeF5BXbu5zf+5bjDEopZRyfV5WB1BKKdU+tNCVUspNaKErpZSb0EJXSik3oYWulFJuQgtdKaXc\nhBa6Ukq5CS10pZRyE1roSinlJnwc+WLdunUziYmJjnxJpZRyeZs3by42xkS09DyHFnpiYiJpaWmO\nfEmllHJ5InLAnufplItSSrkJLXSllHITWuhKKeUmtNCVUspNaKErpZSb0EJXSik3oYWulFJuwiUK\n/fMdh3l7g13LMJVSymO5RKEv2XmYJ5ftpaa+weooSinltFyi0GenxFNWXcey3QVWR1FKKaflEoU+\ntnc34sMDWbQx1+ooSinltFyi0L28hKuT41mXWUJOcZXVcZRSyim5RKEDXJUcj7eXsGhTntVRlFLK\nKblMoUeFBHBR/0g+2JxPXUOj1XGUUsrpuEyhA1yTEk9xZQ0r0vXNUaWU+jGXKvTx/SLoHhLAwo06\n7aKUUj/mUoXu4+3FT5PjWJ1RRH5ZtdVxlFLKqbRY6CLSX0S2nfLrmIj8RkTCRWS5iGTYPnZxROCf\nnhsPwHtp+Y54OaWUapMd+eVc8eI69hdWdvhrtVjoxpi9xpgkY0wSMBKoBj4C7gNWGGP6Aits9ztc\nXJdOjOsbwbubcqnXN0eVUk7unQ25f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KesznMqEYk4uaJLRAKB\nyTjB96Qx5n5jTJwxJpGmf2NfO0uZi0hnEQk+eRu4mHb8AehShQ48aptK2EHTH4SzLOF6DggGltuW\nIr1kdaCTRGSmiOQDY4DPRWSZVVlsbxyfPFg8HXjPWQ4WF5GFwHqgv4jki8jNVmeyGQvMBSbY/m1t\ns408nUE0sNL2/biJpjl0p1oi6ISigLUish3YCHxujFnaXr+5XimqlFJuwtVG6EoppU5DC10ppdyE\nFrpSSrkJLXSllHITWuhKKeUmtNCVUspNaKErpZSb0EJXSik38f8BwsuY87bovo4AAAAASUVORK5C\nYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f00c62e3390>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Show the cost function\n",
    "plt.plot(W_history, cost_history)\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
